<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="template/template.xhtml">
	<ui:define name="content">
		<h:form id="companyBoughtAnalysis" styleClass="horizontal_full">
			<p:breadCrumb>
				<p:menuitem value="Company Reports" url="companyReports.xhtml#" />
				<p:menuitem value="Company Reports" url="companyReports.xhtml" />
				<p:menuitem value="Market Analysis" />
			</p:breadCrumb>

			<h1>
				<h:outputText value="Market Analysis Report (Round: #{reportMBean.selectedRepDec.getRoundNumber()}, #{reportMBean.selectedRepDec.report.reportTypeName})" />
			</h1>

			<p>
				On this page you see the results of the bought market analysis. Depending on which 
				type of market analysis you bought, you can see different values of the market and 
				your competitors.
			</p>

			<p:panelGrid columns="2"
				rendered="#{reportMBean.selectedRepDec.report.reportType>=1}">
				<f:facet name="header">
					General game information
				</f:facet>

				<h:outputLabel for="amountCompanies" value="Number of companies" />
				<h:outputText id="amountCompanies"
					value="#{reportMBean.amountCompanies}" />

				<h:outputLabel for="amountAgents"
					value="Number of customers/agents in selected round" />
				<h:outputText id="amountAgents" value="#{reportMBean.amountAgents}" />

				<h:outputLabel for="amountCompanyProducts"
					value="Number of provided products in selected round" />
				<h:outputText id="amountCompanyProducts"
					value="#{reportMBean.amountCompanyProducts}" />

				<h:outputLabel for="amountDiffProducts"
					value="Number of provided different products in selected round" />
				<h:outputText id="amountDiffProducts"
					value="#{reportMBean.amountDifferentProducts}" />

			</p:panelGrid>
			<br></br>
			
			<p:dataTable id="companySummedUpDecisionsTable" var="compSummedUpDec"
				value="#{reportMBean.companySummedUpDecisionsTable}"
				rendered="#{reportMBean.selectedRepDec.report.reportType>=1}">

				<f:facet name="header">
					<h:outputText value="Company Summed Up Decisions" />
				</f:facet>

				<p:columns value="#{reportMBean.companySummedUpDecisionColumns}"
					var="cdsuColumn" sortBy="#{compSummedUpDec[cdsuColumn.property]}"
					headerText="#{cdsuColumn.header}">
					<h:outputText value="#{compSummedUpDec[cdsuColumn.property]}" />
				</p:columns>
			</p:dataTable>

			<br></br>
			 
			<p:chart type="pie" model="#{reportMBean.pieChartMarketLastRoundSellings}" 
				style="height:300px; width:700px" rendered="#{reportMBean.selectedRepDec.report.reportType>1}"/>

			<br></br>
			 
			<p:dataTable id="companyDecisionsTable" var="compDec"
				value="#{reportMBean.companyDecisionsTable}"
				paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {Exporters}"
				rowsPerPageTemplate="10,25,50,100" paginator="true" rows="10"
				rendered="#{reportMBean.selectedRepDec.report.reportType>1}">

				<f:facet name="{Exporters}">
					<h:commandLink>
						<p:graphicImage library="img" name="excel.png" width="24" />
						<p:dataExporter type="xls" target="companyDecisionsTable"
							fileName="companyDecisionsTable" />
					</h:commandLink>
					<h:commandLink>
						<p:graphicImage library="img" name="pdf.png" width="24" />
						<p:dataExporter type="pdf" target="companyDecisionsTable"
							fileName="companyDecisionsTable" />
					</h:commandLink>
				</f:facet>

				<f:facet name="header">
					<h:outputText value="Company Results And Decisions" />
					<h:outputText value=" (Some Companies)" rendered="#{reportMBean.selectedRepDec.report.reportType==2}"/>
					<h:outputText value=" (All Companies)" rendered="#{reportMBean.selectedRepDec.report.reportType>2}"/>
				</f:facet>

				<p:columns value="#{reportMBean.companyDecisionColumns}"
					var="cdColumn" sortBy="#{compDec[cdColumn.property]}"
					headerText="#{cdColumn.header}">
					<h:outputText value="#{compDec[cdColumn.property]}" />
				</p:columns>
			</p:dataTable>

			<br></br>

			<p:dataTable id="agentsTable" var="agents"
				value="#{reportMBean.agentsTable}"
				paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {Exporters}"
				rowsPerPageTemplate="10,25,50,100" paginator="true" rows="10"
				rendered="#{reportMBean.selectedRepDec.report.reportType>=1}">

				<f:facet name="{Exporters}">
					<h:commandLink>
						<p:graphicImage library="img" name="excel.png" width="24" />
						<p:dataExporter type="xls" target="agentsTable"
							fileName="agentsTable" />
					</h:commandLink>
					<h:commandLink>
						<p:graphicImage library="img" name="pdf.png" width="24" />
						<p:dataExporter type="pdf" target="agentsTable"
							fileName="agentsTable" />
					</h:commandLink>
				</f:facet>

				<f:facet name="header">
					<h:outputText value="Agent Preferences" />
					<h:outputText value=" (Some Agents)" rendered="#{reportMBean.selectedRepDec.report.reportType==1}"/>
					<h:outputText value=" (Some Agents)" rendered="#{reportMBean.selectedRepDec.report.reportType==2}"/>
					<h:outputText value=" (All Agents)" rendered="#{reportMBean.selectedRepDec.report.reportType>2}"/>
				</f:facet>

				<p:columns value="#{reportMBean.agentsColumns}" var="column"
					sortBy="#{agents[column.property]}" headerText="#{column.header}">
					<h:outputText value="#{agents[column.property]}" />
				</p:columns>

				<f:facet name="footer">
					<h:outputText value="#{reportMBean.avgAgentPreference}" rendered="#{reportMBean.selectedRepDec.report.reportType>=3}"/>
				</f:facet>
			</p:dataTable>

			<br></br>

			<h:panelGrid columns="1">
				<p:dataTable id="companyProductTable" var="infos"
					value="#{reportMBean.companyProductTable}"
					paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {Exporters}"
					rowsPerPageTemplate="10,25,50,100" paginator="true" rows="10"
					rendered="#{reportMBean.selectedRepDec.report.reportType>2}">

					<f:facet name="{Exporters}">
						<h:commandLink>
							<p:graphicImage library="img" name="excel.png" width="24" />
							<p:dataExporter type="xls" target="companyProductTable"
								fileName="statistic" />
						</h:commandLink>
						<h:commandLink>
							<p:graphicImage library="img" name="pdf.png" width="24" />
							<p:dataExporter type="pdf" target="companyProductTable"
								fileName="statistic" />
						</h:commandLink>
					</f:facet>

					<f:facet name="header">
						<h:outputText value="Company Products" />
					</f:facet>

					<p:columns value="#{reportMBean.columns}" var="column"
						sortBy="#{infos[column.property]}" headerText="#{column.header}">
						<h:outputText value="#{infos[column.property]}" />
					</p:columns>
				</p:dataTable>

				<br></br>

				
				<p:panel rendered="#{reportMBean.selectedRepDec.report.reportType>2}">
					<!-- 
					<p:chart type="line"
						model="#{reportMBean.barChartMarketGameCompanySellingsPerRoundLine}" />
					 -->
					 <!-- 
					<p:chart type="bubble"
						model="#{reportMBean.bubbleChartMarketLastRoundProducts}" />

					<p:chart type="bar"
						model="#{reportMBean.barChartMarketGameProductSellings}" />

					<p:chart type="bar" model="#{reportMBean.barChartQualityModel}" />

					<p:chart type="bar" model="#{reportMBean.barChartPriceModel}" />

					<p:chart type="bar" model="#{reportMBean.barChartImageModel}" />
 					-->
				</p:panel>
			
			</h:panelGrid>

		</h:form>

	</ui:define>
</ui:composition>

</html>